package org.example.spring.controller.Admin;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.spring.domain.dto.OrderDetailDTO;
import org.example.spring.domain.pojo.Result;
import org.example.spring.service.OrderDetailService;
import org.example.spring.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController("adminOrderDetailController")
@Api(tags = "订单详情管理")
@RequestMapping("/admin/orderDetail")
public class OrderDetailController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private OrderDetailService orderDetailService;


    @ApiOperation(value = "根据订单号获取订单详情")
    @RequestMapping("/getOrderDetailByOrderId")
    public Result<ArrayList<OrderDetailDTO>> getOrderDetailByOrderId(@RequestParam Integer orderId) {
        ArrayList<OrderDetailDTO> orderDetails = orderDetailService.getOrderDetailByOrderId(orderId);
        return Result.success(orderDetails);
    }


}
